package com.trw.trp.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.trw.trp.bean.PropertyBean;

public class SystemSettingDaoProxy extends SystemSettingDao {

	private List<PropertyBean> propList = null;
	private Map<Long, PropertyBean> propMap = null;
	
	SystemSettingDaoProxy(){
		getProperties();
	}

	@Override
	public List<PropertyBean> getProperties() {
		if (propList == null) {
			propList = super.getProperties();
			if (propList != null) {
				propMap = new HashMap<Long, PropertyBean>();
				for (PropertyBean bean : propList) {
					propMap.put(bean.getId(), bean);
				}
			}
		}
		return propList;
	}

	public PropertyBean getProperty(long propId) {
		PropertyBean prop = null;
		if (propMap != null) {
			prop = propMap.get(propId);
		}
		return prop;
	}

}
